package com.example.myproject.jackson;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;

import java.io.IOException;
import java.text.DateFormat;
import java.util.Date;

/**
 * Created by xi on 2018/9/21.
 * beandeserializer
 * 参考NumberDeserializers 这个实现类
 */
public class JacksonDateDeSerializer extends NewDateBasedDeserializer<Date> {
    public JacksonDateDeSerializer() { super(Date.class); }
    public JacksonDateDeSerializer(JacksonDateDeSerializer base, DateFormat df, String formatString) {
        super(base, df, formatString);
    }

    @Override
    protected JacksonDateDeSerializer withDateFormat(DateFormat df, String formatString) {
        return new JacksonDateDeSerializer(this, df, formatString);
    }
    @Override
    public java.util.Date deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
        return _parseDate(p, ctxt);
    }
}
